package com.huiyujiaoyu.util;

import android.app.Dialog;
import android.content.Context;
import android.support.annotation.DrawableRes;

import com.bigkoo.pickerview.OptionsPickerView;
import com.huiyujiaoyu.powertime.R;
import com.huiyujiaoyu.powertime.ui.login.LoginActivity;
import com.huiyujiaoyu.widget.Remind2Dialog;
import com.huiyujiaoyu.widget.RemindDialog;


/**
 * Created by yujunlong on 2017/7/22.
 */

public class DialogUtil {
    public static void showDialog(Dialog dialog){
        if(dialog!=null&&!dialog.isShowing()){
            dialog.show();
        }
    }
    public static void dissDialog(Dialog dialog){
        if(dialog!=null&&dialog.isShowing()){
            dialog.dismiss();
        }
    }

    public static RemindDialog getLoginDialog(final Context c){
         RemindDialog loginDialog = new RemindDialog(c, R.mipmap.hothead,"您还未登录","前往登录","继续浏览","前往登录",R.style.CenterDialogStyle);
         loginDialog.setItemClickListener(new RemindDialog.ItemClickListener() {
            @Override
            public void left() {

            }

            @Override
            public void right() {
                ActivityUtil.startActivity(c,LoginActivity.class);
            }
        });
        return loginDialog;
    }
    public static RemindDialog getOrderDialog(final Context c){
        RemindDialog dialog = new RemindDialog(c, R.mipmap.hothead,"播放失败，请先订阅","","取消","订阅",R.style.CenterDialogStyle);
        dialog.setItemClickListener(new RemindDialog.ItemClickListener() {
            @Override
            public void left() {

            }

            @Override
            public void right() {
               //订阅
            }
        });
        return dialog;
    }

    public static Remind2Dialog getDialog(final Context c, @DrawableRes int resd, String content){
        Remind2Dialog dialog = new Remind2Dialog(c,resd,content,R.style.CenterDialogStyle);
        return dialog;
    }
    public static void showDialog(OptionsPickerView dialog){
        if(dialog!=null&&!dialog.isShowing()){
            dialog.show();
        }
    }
    public static void dissDialog(OptionsPickerView dialog){
        if(dialog!=null&&dialog.isShowing()){
            dialog.dismiss();
        }
    }
}
